package com.sas.hnn;

import android.app.Activity;
import android.app.DialogFragment;
import android.app.Fragment;
import android.app.FragmentTransaction;
import android.os.Bundle;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
import android.widget.ToggleButton;

public class MyDialogFragment extends DialogFragment {
	
	private final String TAG= MyDialogFragment.class.getSimpleName();
    String mFrau;
    /**
     * Create a new instance of MyDialogFragment, providing "num"
     * as an argument.
     */
    static MyDialogFragment newInstance(String fProp) {
        MyDialogFragment f = new MyDialogFragment();

        // Supply num input as an argument.
        Bundle args = new Bundle();
        args.putString("frau", fProp);
        f.setArguments(args);

        return f;
    }

    
    @Override
	public void onAttach(Activity activity) {
		// TODO Auto-generated method stub
		super.onAttach(activity);
		
	}


	@Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        mFrau = getArguments().getString("frau");
        
        
//			andere Themen
//            android.R.style.Theme_Holo_Light_Dialog; break;
//            android.R.style.Theme_Holo_Light; break;
//            android.R.style.Theme_Holo_Light_Panel; break;
//            android.R.style.Theme_Holo_Light; break;
      
        
        setStyle(DialogFragment.STYLE_NO_TITLE, android.R.style.Theme_Holo_Dialog);
        
    }

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
            Bundle savedInstanceState) {
        View v = inflater.inflate(R.layout.fragment_dialog, container, false);
        View tv = v.findViewById(R.id.text);
        ((TextView)tv).setText("Du denkst also Frauen sind "+mFrau);

        // Watch for button clicks.
        Button button = (Button)v.findViewById(R.id.show);
        button.setOnClickListener(new OnClickListener() {
            public void onClick(View v) {
            	FragmentTransaction ft = getFragmentManager().beginTransaction();
                Fragment prev = getFragmentManager().findFragmentByTag("dialog");
                	Log.d(TAG,"remove");
                	dismiss();
                	
            }
        });
        
        return v;
    }
    
    
}